package 每日一题OJ;

/**
 * @author shy_black
 * @date 2019/8/24 14:17
 * @Description:
 */
public class _190_颠倒二进制位 {
    // you need treat n as an unsigned value
    public int reverseBits(int n) {

        int l = 0;
        int res = 0;
        for(int i = 0;i < 32;i++) {
            l = n >> (31-i);
            int tl = l & 1;
            tl = tl << i;
            res = res | tl;
        }
        return res;
    }
}